#ifndef SONGHANDLER_H_
#define SONGHANDLER_H_

#include <qstring.h>
#include <qwidget.h>

#include "songinfo.h" 
#include <mythtv/mythdbcon.h>
#include <mythtv/mythdialogs.h>

class MythMainWindow;
class SongHandler;
class QObject;


class SongHandler
{
  public:
    SongHandler()
    {
    }

    // Used by configuration
    static void processAllSongs(void);
    static void clearAllSongData(void); 


    static SongHandler* newHandler(QString name, QString extensions, QString pathsetting);
    static uint count(void);

    static int buildFileCount(QString directory, SongHandler *handler);
    void buildFileDB(QString directory, SongHandler *handler, 
                     MythProgressDialog *pdial, int* filecount, QString parsestring);

    void processSongs(SongHandler *);

    static void registerHandler(SongHandler *);
    static SongHandler* GetHandler(SongInfo *songinfo);

    QString SongType(void) const { return handlertype; }
    QString getSearchSetting(void) const { return pathsetting; }

    void updateDB(SongInfo& file);
    void findInZIP(SongInfo& foundfile, QString parsestring);
    static QString extractpackage(const SongInfo& data);

  protected:

    bool rebuild;
    uint songplayerid;
    QString handlertype;
    QString pathsetting;
    QStringList validextensions;

  private:
    static SongHandler* newInstance;


};

#endif
